import { imageToSprite, isMobile, loadBase64 } from "../util.js";
import { Keyboard } from '../io/keyboard.js';
// import { initOperate } from '../io/io.js'
class UI {
    constructor(frontStage, resource) {
        // 初始化时确定是否为移动端
        this.isMobile = isMobile();

        if (this.isMobile) {

        } else {
            // this.io = new Keyboard;
        }

        this.frontStage = frontStage;
        this.resource = resource;
        this.UIMap = {};

        // this.MobileOperateUI = {};
    }

    async init() {
        

    }

    /**
     * 移动端
     */
    // async initMobileOperate() {
    //     const frontStage = this.frontStage;
    //     const resource = this.resource;
    //     await resource.loadOutSide("/", "./OutSide/operate.json");
    //     const operate = this.resource.Content.OutSide.operate;

    //     for (const key of Object.keys(operate)) {
    //         if (key === '$') {
    //             continue;
    //         }
    //         const { value, x, y, scale, baseX, baseY } = operate[key];
    //         const image = await loadBase64(value);
    //         const sprite = imageToSprite(image);
    //         sprite.scale.set(scale);
    //         if (baseX === 0) {
    //             sprite.x = x;
    //         } else if (baseX === 1) {
    //             sprite.x = this.app.view.width - x;
    //         }

    //         if (baseY === 0) {
    //             sprite.y = y;
    //         } else if (baseY === 1) {
    //             sprite.y = this.app.view.height - y;
    //         }

    //         frontStage.addChild(sprite);
    //         this.UIMap[key] = sprite;
    //     }
    //     await initOperate();
    // }
}